package Level_two;

import java.util.Random;
import java.util.Scanner;

public class Three {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //数字 1-10 保存到一个长度为 10 的一维数组中
        double[] arr = new double[10];
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入一个1-10的数字");
            double num = scanner.nextDouble();
            arr[i] = num;
        }
        double[] ints = new double[3];
        double sum = 0;
        for (int i = 0; i <ints.length ; i++) {
            int ra = new Random().nextInt(3);
            ints[i] = arr[ra];
            sum += ints[i];
        }
        System.out.println("新数组元素的和为" + sum);
    }
}
